package com.cscec5b.inspection.controller;

import com.cscec5b.inspection.dto.ReceiveDataPushDtos.PushResponse;
import com.cscec5b.inspection.service.ReceiveDataPushService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/tasks")
public class TaskPushController {

    private final ReceiveDataPushService service;

    public TaskPushController(ReceiveDataPushService service) {
        this.service = service;
    }

    /** 前端点击“提交”后调用：把该 taskId 的所有记录组装成一个请求推送到对端 */
    @PostMapping("/{taskId}/upstream")
    public PushResponse push(@PathVariable Long taskId) {
        return service.pushTask(taskId);
    }
}
